package cn.javass.dp.flyweight.example5;

public class Client {

    public static void main(String[] args) {
        SecurityMgr mgr = SecurityMgr.getInstance();
        mgr.login("张三");
        mgr.login("李四");

        boolean f1 = mgr.hasPremit("张三","薪资数据","查看");
        boolean f2 = mgr.hasPremit("李四","薪资数据","查看");
        boolean f3 = mgr.hasPremit("李四","薪资数据","修改");

        System.out.println("f1 == " + f1);
        System.out.println("f2 == " + f2);
        System.out.println("f2 == " + f3);

        try {
            Thread.sleep(4000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        for (int i = 0; i < 3; i++) {
            mgr.login("张三"+i);
            mgr.hasPremit("张三"+i,"薪资数据","查看");
        }

        System.out.println("薪资数据查看" + FlyweightFactory.getInstance().getUserTime("薪资数据,查看"));
        System.out.println("薪资数据修改" + FlyweightFactory.getInstance().getUserTime("薪资数据,修改"));
        System.out.println("人员列表查看" + FlyweightFactory.getInstance().getUserTime("人员列表,查看"));
    }
}
